<template>
<!-- vue3组件中的摸版结构可以没有根标签-->
  <h1>一个人的信息</h1>
  <h2>姓名{{name}}</h2>
  <h2>年龄{{age}}</h2>
  <button @click="changeInfo">修改信息</button>
  <h3>工作类型:{{job.type}}</h3>
  <h3>薪资:{{job.salary}}</h3>
</template>

<script>
import {ref,reactive} from 'vue'
export default {
  name: 'App',
  setup(){
    let name = ref('张三')
    let age = ref(18)
    let job = reactive({
      type:'前端',
      salary:'30k',
    })

    // 方法
    function changeInfo(){
      // name.value = '李四'
      // age.value = 20
      // job.value.type = '后端'
      // job.value.salary = '10000k'
      console.log(job)
    }
    // 返回一个对象
    return{
      name,
      age,
      changeInfo,
      job
    }
  }
}
</script>

<style>

</style>
